package com.yyfax.ph.home.recommendloan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.view.View;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;
import com.yyfax.infrastructure.mvp.Presenter;
import com.yyfax.infrastructure.statistics.StatService;
import com.yyfax.ph.R;
import com.yyfax.ph.StatIDSet;
import com.yyfax.ph.base.BaseYYFaxActivity;
import com.yyfax.ph.base.YJPH;
import com.yyfax.ph.main.MainActivity;

/**
 * 推荐提交成功
 * Created by ying_he on 2017/11/4.<br>
 * Copyright  2017 www.yylending.com. All Rights Reserved.<br><br>
 */

public class RecommendLoanSuccessActivity extends BaseYYFaxActivity {

	private static final String TAG = RecommendLoanSuccessActivity.class.getSimpleName();
	private Unbinder mUnBinder;

	public static void start(Activity aty) {
		aty.startActivity(new Intent(aty, RecommendLoanSuccessActivity.class));
	}

	@Override
	public int getContentViewRes() {
		return R.layout.activity_recommend_loan_success;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mUnBinder = ButterKnife.bind(this);
		setTitle(R.string.submit_success);
		StatService.onEvent(YJPH.getInstance(), StatIDSet.EVENT_ID_B007);
	}

	@OnClick({R.id.go_to_main_btn, R.id.go_to_progress})
	public void onClicked(View view) {
		switch (view.getId()) {
			case R.id.go_to_main_btn:
				StatService.onEvent(YJPH.getInstance(), StatIDSet.EVENT_ID_B008);
				MainActivity.start(this); // 跳转到首页
				finish();
				break;
			case R.id.go_to_progress:
				StatService.onEvent(YJPH.getInstance(), StatIDSet.EVENT_ID_B009);
				// 跳转到进度查询
				MainActivity.startToProgressSearch(this);
				finish();
				break;
			default:
				break;
		}
	}


	@Override
	public Loader<Presenter> onCreateLoader(int id, Bundle args) {
		return null;
	}

	@Override
	public void onLoadFinished(Loader<Presenter> loader, Presenter data, int placeholder) {

	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		mUnBinder.unbind();
	}
}
